//package com.bbzn.user.client.filter;
//
//
//import org.apache.log4j.Logger;
//import org.springframework.boot.web.servlet.ServletComponentScan;
//import org.springframework.stereotype.Component;
//
//import javax.servlet.*;
//import javax.servlet.annotation.WebFilter;
//import javax.servlet.http.HttpServletResponse;
//import java.io.IOException;
//
///**
// * @Author wulongbo
// * @Date 2021/3/31 11:51
// * @Version 1.0
// */
//@Component
//@ServletComponentScan
//@WebFilter(urlPatterns = "/*",filterName = "CorsFilter")
//public class CorsFilter implements Filter {
//    private static Logger log = Logger.getLogger(CorsFilter.class);
//
//
//    @Override
//    public void init(FilterConfig filterConfig) throws ServletException {
//        log.info("添加自定义注解 {}");
//        System.out.print("添加自定义注解");
//    }
//
//    @Override
//    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain)
//            throws IOException, ServletException {
//        HttpServletResponse response = (HttpServletResponse) servletResponse;
//
//        //跨域
//        response.setHeader("Access-Control-Allow-Origin", "*");
//        //跨域 Header
//        response.setHeader("Access-Control-Allow-Methods", "*");
//
//        response.setHeader("Access-Control-Allow-Headers", "Content-Type,XFILENAME,XFILECATEGORY,XFILESIZE,token");
//        filterChain.doFilter(servletRequest, servletResponse);
//    }
//
//    @Override
//    public void destroy() {
//
//    }
//}
